﻿<UserControl x:Class="Big3.Hitbase.Controls.NumericBox"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" Height="25" Width="100" MinHeight="25" MinWidth="80">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition />
            <ColumnDefinition Width="15"/>
        </Grid.ColumnDefinitions>

        <!-- Popup options content -->
        <Popup x:Name="PART_Popup" AllowsTransparency="True" Placement="Left" Width="180" Height="36" 
               PopupAnimation="Fade" MouseLeftButtonDown="optionsPopup_MouseLeftButtonDown" >
            <Grid>
                <Border BorderThickness="1" BorderBrush="Black" Background="White" CornerRadius="2"/>

                <StackPanel Margin="5" Orientation="Horizontal">
                    <TextBlock Text="Increment: " TextWrapping="Wrap" FontSize="14" Margin="5,3,5,0" />
                    <TextBox x:Name="PART_IncrementTextBox" FontSize="14" Width="80" KeyDown="incrementTB_KeyDown"/>
                </StackPanel>
            </Grid>
        </Popup>

        <!-- Text field for value -->
        <TextBox x:Name="PART_NumericTextBox" Grid.ColumnSpan="2" PreviewTextInput="numericBox_TextInput" MouseWheel="numericBox_MouseWheel">
            <TextBox.ContextMenu>
                <ContextMenu>
                    <MenuItem x:Name="PART_MenuItem" Header="Options" Click="MenuItem_Click" />
                </ContextMenu>
            </TextBox.ContextMenu>
        </TextBox>
        
        <!-- Increase/Decrease buttons -->
        <Grid Grid.Column="1">
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition />
            </Grid.RowDefinitions>
            <Button x:Name="PART_IncreaseButton" Grid.Row="0" Margin="0,0,0,0.2" Click="increaseBtn_Click"
                    PreviewMouseLeftButtonDown="increaseBtn_PreviewMouseLeftButtonDown" PreviewMouseLeftButtonUp="increaseBtn_PreviewMouseLeftButtonUp">
                <Button.Content>
                    <Polygon Stroke="Black" Fill="LightSkyBlue" StrokeThickness="0.2" Points="0,0 -2,5 2,5" Stretch="Fill"/>
                </Button.Content>
            </Button>
            <Button x:Name="PART_DecreaseButton" Grid.Row="1" Margin="0,0.2,0,0" Click="decreaseBtn_Click"
                    PreviewMouseLeftButtonDown="decreaseBtn_PreviewMouseLeftButtonDown" PreviewMouseLeftButtonUp="decreaseBtn_PreviewMouseLeftButtonUp">
                <Button.Content>
                    <Polygon Stroke="Black" Fill="LightSkyBlue" StrokeThickness="0.2" Points="-2,0 2,0 0,5 " Stretch="Fill"/>
                </Button.Content>
            </Button>
        </Grid>
        
    </Grid>
</UserControl>
